Skip to content

pdf broken encoding reader #522

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 28 commits into
base: develop
Choose a base branch
from
Open

Conversation

sinkudo
Copy link

@sinkudo sinkudo commented Apr 3, 2025

Reader to extract code from PDF with complex background using information from PDF

added my code from project needed to extract text:

  1. reader
  2. config
  3. h5 models
  4. text post processing
  5. fontforge wrapper
  6. example pdf

added script to scripts dir to extract text using reader

edited index.html, api_args, manager_config, gitignore and requirements

@NastyBoget NastyBoget self-requested a review April 7, 2025 11:10
@NastyBoget NastyBoget added the enhancement New feature or request label Apr 7, 2025
@NastyBoget
Copy link
Collaborator

Please look to the logs of test pipelines - they all should pass before merge

call_classifier=False))
return lines, tables, page.attachments, []

def __handle_page(self, page: PDFPage, page_number: int, path: str,
Copy link
Collaborator

@oksidgy oksidgy Apr 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is dublicated code of dedoc/readers/pdf_reader/pdf_txtlayer_reader/pdfminer_reader/pdfminer_extractor.py with different that you use own layout (pass own layout ). Try to use code of dedoc/readers/pdf_reader/pdf_txtlayer_reader/pdfminer_reader/pdfminer_extractor.py with small changes of code of pdfminer_extractor.py.

For example in file dedoc/readers/pdf_reader/pdf_txtlayer_reader/pdfminer_reader/pdfminer_extractor.py:

  1. do pubic function def __handle_page(...) -> def handle_page(...)
  2. added small changes into code:
def handle_page(self, page: PDFPage, page_number: int, path: str, parameters: ParametersForParseDoc, Layout: Optional[LTPage] = None) -> PageWithBBox:
...
if not layout:
     layout = device.get_result()
...

So, by adding these small changes you will get rid of 300 lines of duplicate code!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Collaborator

@oksidgy oksidgy Jun 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Почему добавили еще одну функцию handle_page, если эта функция уже есть? Ее достаточно просто изменить как показано в примере выше. А то снова код дублируется, получается две почти одинаковые функции handle_page в одном классе

@sinkudo
Copy link
Author

sinkudo commented May 21, 2025

problems with imports (numpy) during running tests installs numpy 2.0.2 but required numpy<2.0. Runned even on dedoc without my commits on devolopment branch, but problem remains. Please check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants